package com.imooc.set_;

import java.util.HashSet;

/**
 * @Date:2022/4/6/19:38
 * @Description:测试，HashSet在增加元素中，都位于table数组中同一下标的链表中元素个数增加，table数组是否扩容
 */
@SuppressWarnings({"all"})
public class HashSetIncreasement {
    public static void main(String[] args) {
        HashSet<Object> hashSet = new HashSet<>();
        for (int i = 1; i <= 7; i++) {
            hashSet.add(new A(i));
        }

        for (int i = 1; i <= 7; i++) {
            hashSet.add(new B(i));
        }




    }
}

class A{
    private int a;
    public A(int i) {
        this.a=i;
    }

    @Override
    public int hashCode() {
        return 100;
    }
}

class B{
    private int b;
    public B(int i) {
        this.b=i;
    }

    @Override
    public int hashCode() {
        return 200;
    }
}